home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / MacTCP.p < prev    next >
Encoding:
Text File  |  1996-05-04  |  19.6 KB  |  790 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MacTCP.p
  3.  
  4.      Contains:    TCP Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacTCP 2.0.6
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT MacTCP;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __MACTCP__}
  30. {$SETC __MACTCP__ := 1}
  31.  
  32. {$I+}
  33. {$SETC MacTCPIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __APPLETALK__}
  43. {$I AppleTalk.p}
  44. {$ENDC}
  45. {    OSUtils.p                                                    }
  46. {        MixedMode.p                                                }
  47. {        Memory.p                                                }
  48.  
  49. {$PUSH}
  50. {$ALIGN MAC68K}
  51. {$LibExport+}
  52. {
  53. Developer Notes:
  54.         0. This MacTCP header replaces what used to be defined in the following header files
  55.             MacTCPCommonTypes.h
  56.             GetMyIPAddr.h
  57.             MiscIPPB.h
  58.             TCPPB.h
  59.             UDPPB.h 
  60.             
  61.             When the various control calls are made to the ip driver, you must set up a 
  62.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  63.             Otherwise, the 68K driver code, will not correctly call your routine.
  64.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  65.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  66.             the ioCompletion parameter.
  67.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  68.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  69.             to pass in the ioCompletion field of the parameter block.
  70.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  71.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  72.             of the parameter block
  73.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  74.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  75.             universal procptr to pass in the ioCompletion field of the paramter
  76.             block.
  77.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  78.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  79.             of the parameter block
  80.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  81.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  82.             universal procptr to pass in the ioCompletion field of the paramter
  83.             block.
  84.         7. For all calls implementing a notifyProc or ioCompletion routine
  85.             which was set up using a NewTCPRoutineProc call, do not call
  86.             DisposeRoutineSDescriptor on the universal procptr until
  87.             after the completion or notify proc has completed.
  88. }
  89. { MacTCP return Codes in the range -23000 through -23049 }
  90.  
  91. CONST
  92.     inProgress                    = 1;                            { I/O in progress }
  93.     ipBadLapErr                    = -23000;                        { bad network configuration }
  94.     ipBadCnfgErr                = -23001;                        { bad IP configuration error }
  95.     ipNoCnfgErr                    = -23002;                        { missing IP or LAP configuration error }
  96.     ipLoadErr                    = -23003;                        { error in MacTCP load }
  97.     ipBadAddr                    = -23004;                        { error in getting address }
  98.     connectionClosing            = -23005;                        { connection is closing }
  99.     invalidLength                = -23006;
  100.     connectionExists            = -23007;                        { request conflicts with existing connection }
  101.     connectionDoesntExist        = -23008;                        { connection does not exist }
  102.     insufficientResources        = -23009;                        { insufficient resources to perform request }
  103.     invalidStreamPtr            = -23010;
  104.     streamAlreadyOpen            = -23011;
  105.     connectionTerminated        = -23012;
  106.     invalidBufPtr                = -23013;
  107.     invalidRDS                    = -23014;
  108.     invalidWDS                    = -23014;
  109.     openFailed                    = -23015;
  110.     commandTimeout                = -23016;
  111.     duplicateSocket                = -23017;
  112.  
  113. { Error codes from internal IP functions }
  114.     ipDontFragErr                = -23032;                        { Packet too large to send w/o fragmenting }
  115.     ipDestDeadErr                = -23033;                        { destination not responding }
  116.     icmpEchoTimeoutErr            = -23035;                        { ICMP echo timed-out }
  117.     ipNoFragMemErr                = -23036;                        { no memory to send fragmented pkt }
  118.     ipRouteErr                    = -23037;                        { can't route packet off-net }
  119.     nameSyntaxErr                = -23041;
  120.     cacheFault                    = -23042;
  121.     noResultProc                = -23043;
  122.     noNameServer                = -23044;
  123.     authNameErr                    = -23045;
  124.     noAnsErr                    = -23046;
  125.     dnrErr                        = -23047;
  126.     outOfMemory                    = -23048;
  127.  
  128.     BYTES_16WORD                = 2;                            { bytes per = 16, bit ip word }
  129.     BYTES_32WORD                = 4;                            { bytes per = 32, bit ip word }
  130.     BYTES_64WORD                = 8;                            { bytes per = 64, bit ip word }
  131.  
  132. { 8-bit quantity }
  133.     
  134. TYPE
  135.     b_8 = UInt8;
  136.  
  137. { 16-bit quantity }
  138.     b_16 = UInt16;
  139.  
  140. { 32-bit quantity }
  141.     b_32 = UInt32;
  142.  
  143. { IP address is 32-bits }
  144.     ip_addr = b_32;
  145.  
  146.     ip_addrbytes = RECORD
  147.         CASE INTEGER OF
  148.         0: (
  149.             addr:                        b_32;
  150.            );
  151.         1: (
  152.             byte:                        PACKED ARRAY [0..3] OF SInt8; (* UInt8 *)
  153.            );
  154.  
  155.     END;
  156.  
  157.     wdsEntry = RECORD
  158.         length:                    INTEGER;                                { length of buffer }
  159.         ptr:                    Ptr;                                    { pointer to buffer }
  160.     END;
  161.  
  162.     rdsEntry = RECORD
  163.         length:                    INTEGER;                                { length of buffer }
  164.         ptr:                    Ptr;                                    { pointer to buffer }
  165.     END;
  166.  
  167.     BufferPtr = LONGINT;
  168.  
  169.     StreamPtr = LONGINT;
  170.  
  171.  
  172. CONST
  173.     netUnreach                    = 0;
  174.     hostUnreach                    = 1;
  175.     protocolUnreach                = 2;
  176.     portUnreach                    = 3;
  177.     fragReqd                    = 4;
  178.     sourceRouteFailed            = 5;
  179.     timeExceeded                = 6;
  180.     parmProblem                    = 7;
  181.     missingOption                = 8;
  182.     lastICMPMsgType                = 32767;
  183.  
  184.     
  185. TYPE
  186.     ICMPMsgType = INTEGER;
  187.  
  188.     ip_port = b_16;
  189.  
  190.     ICMPReport = RECORD
  191.         streamPtr:                StreamPtr;
  192.         localHost:                ip_addr;
  193.         localPort:                ip_port;
  194.         remoteHost:                ip_addr;
  195.         remotePort:                ip_port;
  196.         reportType:                INTEGER;
  197.         optionalAddlInfo:        INTEGER;
  198.         optionalAddlInfoPtr:    LONGINT;
  199.     END;
  200.  
  201. { csCode to get our IP address }
  202.  
  203. CONST
  204.     ipctlGetAddr                = 15;
  205.  
  206. TYPE
  207.     GetIPIOCompletionProcPtr = ProcPtr;  { PROCEDURE GetIPIOCompletion(VAR iopb: GetAddrParamBlock); }
  208.     GetIPIOCompletionUPP = UniversalProcPtr;
  209.  
  210.     GetAddrParamBlock = RECORD
  211.         qLink:                    ^QElem;
  212.         qType:                    INTEGER;
  213.         ioTrap:                    INTEGER;
  214.         ioCmdAddr:                Ptr;
  215.         ioCompletion:            GetIPIOCompletionUPP;
  216.         ioResult:                OSErr;
  217.         ioNamePtr:                StringPtr;
  218.         ioVRefNum:                INTEGER;
  219.         ioCRefNum:                INTEGER;
  220.         csCode:                    INTEGER;                                { standard I/O header }
  221.         ourAddress:                ip_addr;                                { our IP address }
  222.         ourNetMask:                LONGINT;                                { our IP net mask }
  223.     END;
  224.  
  225. { control codes }
  226.  
  227. CONST
  228.     ipctlEchoICMP                = 17;                            { send icmp echo }
  229.     ipctlLAPStats                = 19;                            { get lap stats }
  230.  
  231. TYPE
  232.     IPIOCompletionProcPtr = ProcPtr;  { PROCEDURE IPIOCompletion(VAR iopb: ICMPParamBlock); }
  233.     IPIOCompletionUPP = UniversalProcPtr;
  234.  
  235.     ICMPParamBlock = RECORD
  236.         qLink:                    ^QElem;
  237.         qType:                    INTEGER;
  238.         ioTrap:                    INTEGER;
  239.         ioCmdAddr:                Ptr;
  240.         ioCompletion:            IPIOCompletionUPP;
  241.         ioResult:                OSErr;
  242.         ioNamePtr:                StringPtr;
  243.         ioVRefNum:                INTEGER;
  244.         ioCRefNum:                INTEGER;
  245.         csCode:                    INTEGER;                                { standard I/O header }
  246.         params:                    ARRAY [0..10] OF INTEGER;
  247.         icmpEchoInfo:            RECORD
  248.                 echoRequestOut:                    LONGINT;                        { time in ticks of when the echo request went out }
  249.                 echoReplyIn:                    LONGINT;                        { time in ticks of when the reply was received }
  250.                 echoedData:                        rdsEntry;                        { data received in responce }
  251.                 options:                        Ptr;
  252.                 userDataPtr:                    LONGINT;
  253.             END;
  254.  
  255.  
  256.     END;
  257.  
  258.     ICMPEchoNotifyProcPtr = ProcPtr;  { PROCEDURE ICMPEchoNotify(VAR iopb: ICMPParamBlock); }
  259.     ICMPEchoNotifyUPP = UniversalProcPtr;
  260.  
  261.     IPParamBlock = RECORD
  262.         qLink:                    ^QElem;
  263.         qType:                    INTEGER;
  264.         ioTrap:                    INTEGER;
  265.         ioCmdAddr:                Ptr;
  266.         ioCompletion:            IPIOCompletionUPP;
  267.         ioResult:                OSErr;
  268.         ioNamePtr:                StringPtr;
  269.         ioVRefNum:                INTEGER;
  270.         ioCRefNum:                INTEGER;
  271.         csCode:                    INTEGER;                                { standard I/O header }
  272.         CASE INTEGER OF
  273.         0: (
  274.             dest:                        ip_addr;                            { echo to IP address }
  275.             data:                        wdsEntry;
  276.             timeout:                    INTEGER;
  277.             options:                    Ptr;
  278.             optLength:                    INTEGER;
  279.             icmpCompletion:                ICMPEchoNotifyUPP;
  280.             userDataPtr:                LONGINT;
  281.            );
  282.         1: (
  283.             lapStatsPtr:                ^LAPStats;
  284.            );
  285.  
  286.     END;
  287.  
  288.     LAPStatsAddrXlation = RECORD
  289.         CASE INTEGER OF
  290.         0: (
  291.             arp_table:                    ^arp_entry;
  292.            );
  293.         1: (
  294.             nbp_table:                    ^nbp_entry;
  295.            );
  296.     END;
  297.  
  298.     LAPStats = RECORD
  299.         ifType:                    INTEGER;
  300.         ifString:                ^CHAR;
  301.         ifMaxMTU:                INTEGER;
  302.         ifSpeed:                LONGINT;
  303.         ifPhyAddrLength:        INTEGER;
  304.         ifPhysicalAddress:        ^CHAR;
  305.         AddrXlation:            LAPStatsAddrXlation;
  306.         slotNumber:                INTEGER;
  307.     END;
  308.  
  309.     nbp_entry = RECORD
  310.         ip_address:                ip_addr;                                { IP address }
  311.         at_address:                AddrBlock;                                { matching AppleTalk address }
  312.         gateway:                BOOLEAN;                                { TRUE if entry for a gateway }
  313.         valid:                    BOOLEAN;                                { TRUE if LAP address is valid }
  314.         probing:                BOOLEAN;                                { TRUE if NBP lookup pending }
  315.         afiller:                SInt8;                                    { Filler for proper byte alignment     }
  316.         age:                    LONGINT;                                { ticks since cache entry verified }
  317.         access:                    LONGINT;                                { ticks since last access }
  318.         filler:                    ARRAY [0..115] OF SInt8;                { for internal use only !!! }
  319.     END;
  320.  
  321.     Enet_addr = RECORD
  322.         en_hi:                    b_16;
  323.         en_lo:                    b_32;
  324.     END;
  325.  
  326.     arp_entry = RECORD
  327.         age:                    INTEGER;                                { cache aging field }
  328.         protocol:                b_16;                                    { Protocol type }
  329.         ip_address:                ip_addr;                                { IP address }
  330.         en_address:                Enet_addr;                                { matching Ethernet address }
  331.     END;
  332.  
  333. { number of ARP table entries }
  334.  
  335. CONST
  336.     ARP_TABLE_SIZE                = 20;
  337.  
  338.     NBP_TABLE_SIZE                = 20;                            { number of NBP table entries }
  339.     NBP_MAX_NAME_SIZE            = 16 + 10 + 2;
  340.  
  341. { Command codes }
  342.     TCPCreate                    = 30;
  343.     TCPPassiveOpen                = 31;
  344.     TCPActiveOpen                = 32;
  345.     TCPSend                        = 34;
  346.     TCPNoCopyRcv                = 35;
  347.     TCPRcvBfrReturn                = 36;
  348.     TCPRcv                        = 37;
  349.     TCPClose                    = 38;
  350.     TCPAbort                    = 39;
  351.     TCPStatus                    = 40;
  352.     TCPExtendedStat                = 41;
  353.     TCPRelease                    = 42;
  354.     TCPGlobalInfo                = 43;
  355.     TCPCtlMax                    = 49;
  356.  
  357.     TCPClosing                    = 1;
  358.     TCPULPTimeout                = 2;
  359.     TCPTerminate                = 3;
  360.     TCPDataArrival                = 4;
  361.     TCPUrgent                    = 5;
  362.     TCPICMPReceived                = 6;
  363.     lastEvent                    = 32767;
  364.  
  365.     
  366. TYPE
  367.     TCPEventCode = INTEGER;
  368.  
  369.  
  370. CONST
  371.     TCPRemoteAbort                = 2;
  372.     TCPNetworkFailure            = 3;
  373.     TCPSecPrecMismatch            = 4;
  374.     TCPULPTimeoutTerminate        = 5;
  375.     TCPULPAbort                    = 6;
  376.     TCPULPClose                    = 7;
  377.     TCPServiceError                = 8;
  378.     lastReason                    = 32767;
  379.  
  380.     
  381. TYPE
  382.     TCPTerminationReason = INTEGER;
  383.  
  384.     TCPNotifyProcPtr = ProcPtr;  { PROCEDURE TCPNotify(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport); }
  385.     TCPNotifyUPP = UniversalProcPtr;
  386.  
  387.     tcp_port = INTEGER;
  388.  
  389. { ValidityFlags }
  390.  
  391. CONST
  392.     timeoutValue                = $80;
  393.     timeoutAction                = $40;
  394.     typeOfService                = $20;
  395.     precedence                    = $10;
  396.  
  397. { TOSFlags }
  398.     lowDelay                    = $01;
  399.     throughPut                    = $02;
  400.     reliability                    = $04;
  401.  
  402.  
  403. TYPE
  404.     TCPCreatePB = RECORD
  405.         rcvBuff:                Ptr;
  406.         rcvBuffLen:                LONGINT;
  407.         notifyProc:                TCPNotifyUPP;
  408.         userDataPtr:            Ptr;
  409.     END;
  410.  
  411.     TCPOpenPB = RECORD
  412.         ulpTimeoutValue:        SInt8;
  413.         ulpTimeoutAction:        SInt8;
  414.         validityFlags:            SInt8;
  415.         commandTimeoutValue:    SInt8;
  416.         remoteHost:                ip_addr;
  417.         remotePort:                tcp_port;
  418.         localHost:                ip_addr;
  419.         localPort:                tcp_port;
  420.         tosFlags:                SInt8;
  421.         precedence:                SInt8;
  422.         dontFrag:                BOOLEAN;
  423.         timeToLive:                SInt8;
  424.         security:                SInt8;
  425.         optionCnt:                SInt8;
  426.         options:                ARRAY [0..39] OF SInt8;
  427.         userDataPtr:            Ptr;
  428.     END;
  429.  
  430.     TCPSendPB = RECORD
  431.         ulpTimeoutValue:        SInt8;
  432.         ulpTimeoutAction:        SInt8;
  433.         validityFlags:            SInt8;
  434.         pushFlag:                BOOLEAN;
  435.         urgentFlag:                BOOLEAN;
  436.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  437.         wdsPtr:                    Ptr;
  438.         sendFree:                LONGINT;
  439.         sendLength:                INTEGER;
  440.         userDataPtr:            Ptr;
  441.     END;
  442.  
  443. { for receive and return rcv buff calls }
  444. {   Note: the filler in the following structure is in a different location than }
  445. {         that specified in the Programmer's Guide.  }
  446.     TCPReceivePB = RECORD
  447.         commandTimeoutValue:    SInt8;
  448.         markFlag:                BOOLEAN;
  449.         urgentFlag:                BOOLEAN;
  450.         filler:                    SInt8;                                    { Filler for proper byte alignment  }
  451.         rcvBuff:                Ptr;
  452.         rcvBuffLen:                INTEGER;
  453.         rdsPtr:                    Ptr;
  454.         rdsLength:                INTEGER;
  455.         secondTimeStamp:        INTEGER;
  456.         userDataPtr:            Ptr;
  457.     END;
  458.  
  459.     TCPClosePB = RECORD
  460.         ulpTimeoutValue:        SInt8;
  461.         ulpTimeoutAction:        SInt8;
  462.         validityFlags:            SInt8;
  463.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  464.         userDataPtr:            Ptr;
  465.     END;
  466.  
  467.     HistoBucket = RECORD
  468.         value:                    INTEGER;
  469.         counter:                LONGINT;
  470.     END;
  471.  
  472.  
  473. CONST
  474.     NumOfHistoBuckets            = 7;
  475.  
  476.  
  477. TYPE
  478.     TCPConnectionStats = RECORD
  479.         dataPktsRcvd:            LONGINT;
  480.         dataPktsSent:            LONGINT;
  481.         dataPktsResent:            LONGINT;
  482.         bytesRcvd:                LONGINT;
  483.         bytesRcvdDup:            LONGINT;
  484.         bytesRcvdPastWindow:    LONGINT;
  485.         bytesSent:                LONGINT;
  486.         bytesResent:            LONGINT;
  487.         numHistoBuckets:        INTEGER;
  488.         sentSizeHisto:            ARRAY [0..NumOfHistoBuckets-1] OF HistoBucket;
  489.         lastRTT:                INTEGER;
  490.         tmrSRTT:                INTEGER;
  491.         rttVariance:            INTEGER;
  492.         tmrRTO:                    INTEGER;
  493.         sendTries:                SInt8;
  494.         sourchQuenchRcvd:        SInt8;
  495.     END;
  496.  
  497.     TCPStatusPB = RECORD
  498.         ulpTimeoutValue:        SInt8;
  499.         ulpTimeoutAction:        SInt8;
  500.         unused:                    LONGINT;
  501.         remoteHost:                ip_addr;
  502.         remotePort:                tcp_port;
  503.         localHost:                ip_addr;
  504.         localPort:                tcp_port;
  505.         tosFlags:                SInt8;
  506.         precedence:                SInt8;
  507.         connectionState:        SInt8;
  508.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  509.         sendWindow:                INTEGER;
  510.         rcvWindow:                INTEGER;
  511.         amtUnackedData:            INTEGER;
  512.         amtUnreadData:            INTEGER;
  513.         securityLevelPtr:        Ptr;
  514.         sendUnacked:            LONGINT;
  515.         sendNext:                LONGINT;
  516.         congestionWindow:        LONGINT;
  517.         rcvNext:                LONGINT;
  518.         srtt:                    LONGINT;
  519.         lastRTT:                LONGINT;
  520.         sendMaxSegSize:            LONGINT;
  521.         connStatPtr:            ^TCPConnectionStats;
  522.         userDataPtr:            Ptr;
  523.     END;
  524.  
  525.     TCPAbortPB = RECORD
  526.         userDataPtr:            Ptr;
  527.     END;
  528.  
  529.     TCPParam = RECORD
  530.         tcpRtoA:                LONGINT;
  531.         tcpRtoMin:                LONGINT;
  532.         tcpRtoMax:                LONGINT;
  533.         tcpMaxSegSize:            LONGINT;
  534.         tcpMaxConn:                LONGINT;
  535.         tcpMaxWindow:            LONGINT;
  536.     END;
  537.  
  538.     TCPStats = RECORD
  539.         tcpConnAttempts:        LONGINT;
  540.         tcpConnOpened:            LONGINT;
  541.         tcpConnAccepted:        LONGINT;
  542.         tcpConnClosed:            LONGINT;
  543.         tcpConnAborted:            LONGINT;
  544.         tcpOctetsIn:            LONGINT;
  545.         tcpOctetsOut:            LONGINT;
  546.         tcpOctetsInDup:            LONGINT;
  547.         tcpOctetsRetrans:        LONGINT;
  548.         tcpInputPkts:            LONGINT;
  549.         tcpOutputPkts:            LONGINT;
  550.         tcpDupPkts:                LONGINT;
  551.         tcpRetransPkts:            LONGINT;
  552.     END;
  553.  
  554.     StreamPPtr = ^StreamPtr;
  555.  
  556.     TCPGlobalInfoPB = RECORD
  557.         tcpParamPtr:            ^TCPParam;
  558.         tcpStatsPtr:            ^TCPStats;
  559.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  560.         userDataPtr:            Ptr;
  561.         maxTCPConnections:        INTEGER;
  562.     END;
  563.  
  564.     TCPIOCompletionProcPtr = ProcPtr;  { PROCEDURE TCPIOCompletion(VAR iopb: TCPiopb); }
  565.     TCPIOCompletionUPP = UniversalProcPtr;
  566.  
  567.     TCPiopb = RECORD
  568.         fill12:                    ARRAY [0..11] OF SInt8;
  569.         ioCompletion:            TCPIOCompletionUPP;
  570.         ioResult:                INTEGER;
  571.         ioNamePtr:                Ptr;
  572.         ioVRefNum:                INTEGER;
  573.         ioCRefNum:                INTEGER;
  574.         csCode:                    INTEGER;
  575.         tcpStream:                StreamPtr;
  576.         CASE INTEGER OF
  577.         0: (
  578.             create:                        TCPCreatePB;
  579.            );
  580.         1: (
  581.             open:                        TCPOpenPB;
  582.            );
  583.         2: (
  584.             send:                        TCPSendPB;
  585.            );
  586.         3: (
  587.             receive:                    TCPReceivePB;
  588.            );
  589.         4: (
  590.             close:                        TCPClosePB;
  591.            );
  592.         5: (
  593.             abort:                        TCPAbortPB;
  594.            );
  595.         6: (
  596.             status:                        TCPStatusPB;
  597.            );
  598.         7: (
  599.             globalInfo:                    TCPGlobalInfoPB;
  600.            );
  601.  
  602.     END;
  603.  
  604.  
  605. CONST
  606.     UDPCreate                    = 20;
  607.     UDPRead                        = 21;
  608.     UDPBfrReturn                = 22;
  609.     UDPWrite                    = 23;
  610.     UDPRelease                    = 24;
  611.     UDPMaxMTUSize                = 25;
  612.     UDPStatus                    = 26;
  613.     UDPMultiCreate                = 27;
  614.     UDPMultiSend                = 28;
  615.     UDPMultiRead                = 29;
  616.     UDPCtlMax                    = 29;
  617.  
  618.     UDPDataArrival                = 1;
  619.     UDPICMPReceived                = 2;
  620.     lastUDPEvent                = 32767;
  621.  
  622.     
  623. TYPE
  624.     UDPEventCode = INTEGER;
  625.  
  626.     UDPNotifyProcPtr = ProcPtr;  { PROCEDURE UDPNotify(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport); }
  627.     UDPNotifyUPP = UniversalProcPtr;
  628.  
  629.     udp_port = INTEGER;
  630.  
  631. { for create and release calls }
  632.     UDPCreatePB = RECORD
  633.         rcvBuff:                Ptr;
  634.         rcvBuffLen:                LONGINT;
  635.         notifyProc:                UDPNotifyUPP;
  636.         localPort:                INTEGER;
  637.         userDataPtr:            Ptr;
  638.         endingPort:                udp_port;
  639.     END;
  640.  
  641.     UDPSendPB = RECORD
  642.         reserved:                INTEGER;
  643.         remoteHost:                ip_addr;
  644.         remotePort:                udp_port;
  645.         wdsPtr:                    Ptr;
  646.         checkSum:                BOOLEAN;
  647.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  648.         sendLength:                INTEGER;
  649.         userDataPtr:            Ptr;
  650.         localPort:                udp_port;
  651.     END;
  652.  
  653. { for receive and buffer return calls }
  654.     UDPReceivePB = RECORD
  655.         timeOut:                INTEGER;
  656.         remoteHost:                ip_addr;
  657.         remotePort:                udp_port;
  658.         rcvBuff:                Ptr;
  659.         rcvBuffLen:                INTEGER;
  660.         secondTimeStamp:        INTEGER;
  661.         userDataPtr:            Ptr;
  662.         destHost:                ip_addr;                                { only for use with multi rcv }
  663.         destPort:                udp_port;                                { only for use with multi rcv }
  664.     END;
  665.  
  666.     UDPMTUPB = RECORD
  667.         mtuSize:                INTEGER;
  668.         remoteHost:                ip_addr;
  669.         userDataPtr:            Ptr;
  670.     END;
  671.  
  672.     UDPIOCompletionProcPtr = ProcPtr;  { PROCEDURE UDPIOCompletion(VAR iopb: UDPiopb); }
  673.     UDPIOCompletionUPP = UniversalProcPtr;
  674.  
  675.     UDPiopb = RECORD
  676.         fill12:                    ARRAY [0..11] OF SInt8;
  677.         ioCompletion:            UDPIOCompletionUPP;
  678.         ioResult:                INTEGER;
  679.         ioNamePtr:                Ptr;
  680.         ioVRefNum:                INTEGER;
  681.         ioCRefNum:                INTEGER;
  682.         csCode:                    INTEGER;
  683.         udpStream:                StreamPtr;
  684.         CASE INTEGER OF
  685.         0: (
  686.             create:                        UDPCreatePB;
  687.            );
  688.         1: (
  689.             send:                        UDPSendPB;
  690.            );
  691.         2: (
  692.             receive:                    UDPReceivePB;
  693.            );
  694.         3: (
  695.             mtu:                        UDPMTUPB;
  696.            );
  697.  
  698.     END;
  699.  
  700.  
  701. CONST
  702.     uppGetIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  703.     uppIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  704.     uppICMPEchoNotifyProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  705.     uppTCPNotifyProcInfo = $0000EEC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 2 byte param, 4 byte param); }
  706.     uppTCPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  707.     uppUDPNotifyProcInfo = $00003EC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 4 byte param); }
  708.     uppUDPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  709.  
  710. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  711.     {$IFC NOT GENERATINGCFM }
  712.     INLINE $2E9F;
  713.     {$ENDC}
  714.  
  715. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  716.     {$IFC NOT GENERATINGCFM }
  717.     INLINE $2E9F;
  718.     {$ENDC}
  719.  
  720. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  721.     {$IFC NOT GENERATINGCFM }
  722.     INLINE $2E9F;
  723.     {$ENDC}
  724.  
  725. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  726.     {$IFC NOT GENERATINGCFM }
  727.     INLINE $2E9F;
  728.     {$ENDC}
  729.  
  730. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  731.     {$IFC NOT GENERATINGCFM }
  732.     INLINE $2E9F;
  733.     {$ENDC}
  734.  
  735. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  736.     {$IFC NOT GENERATINGCFM }
  737.     INLINE $2E9F;
  738.     {$ENDC}
  739.  
  740. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  741.     {$IFC NOT GENERATINGCFM }
  742.     INLINE $2E9F;
  743.     {$ENDC}
  744.  
  745. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  746.     {$IFC NOT GENERATINGCFM}
  747.     INLINE $205F, $4E90;
  748.     {$ENDC}
  749.  
  750. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  751.     {$IFC NOT GENERATINGCFM}
  752.     INLINE $205F, $4E90;
  753.     {$ENDC}
  754.  
  755. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  756.     {$IFC NOT GENERATINGCFM}
  757.     INLINE $205F, $4E90;
  758.     {$ENDC}
  759.  
  760. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  761.     {$IFC NOT GENERATINGCFM}
  762.     INLINE $205F, $4E90;
  763.     {$ENDC}
  764.  
  765. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  766.     {$IFC NOT GENERATINGCFM}
  767.     INLINE $205F, $4E90;
  768.     {$ENDC}
  769.  
  770. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  771.     {$IFC NOT GENERATINGCFM}
  772.     INLINE $205F, $4E90;
  773.     {$ENDC}
  774.  
  775. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  776.     {$IFC NOT GENERATINGCFM}
  777.     INLINE $205F, $4E90;
  778.     {$ENDC}
  779.  
  780. {$ALIGN RESET}
  781. {$POP}
  782.  
  783. {$SETC UsingIncludes := MacTCPIncludes}
  784.  
  785. {$ENDC} {__MACTCP__}
  786.  
  787. {$IFC NOT UsingIncludes}
  788.  END.
  789. {$ENDC}
  790.